/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.comprasPublicas.dao;

import br.com.comprasPublicas.util.HibernateUtil;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

/**
 *
 * @author helsen
 */
public class DAOPedido {
    private final Session sessao;
    Transaction transacao = null;

    public DAOPedido()
    {
        sessao = HibernateUtil.getSessao();
    }

    public List lista_grupo(String parametro) {
        transacao = sessao.beginTransaction();

        Query query = sessao.createQuery("from Secao where id_secao = :id_sec");
        query.setString("id_sec", parametro);

        List secaoList = query.list();

        executa_transacao();

        return secaoList;
    }

    public void executa_transacao()
    {
        transacao.commit();
        sessao.close();
    }
}
